#!/bin/bash

# === 配置 ===
DB_NAME="gforum"
DB_USER="root"
DB_PASS="mysql"     
DB_HOST="127.0.0.1"
DB_PORT="3306"

# === 操作开始 ===
echo "Dropping database '${DB_NAME}'..."
mysql -u"$DB_USER" -p"$DB_PASS" -h "$DB_HOST" -P "$DB_PORT" -e "DROP DATABASE IF EXISTS \`${DB_NAME}\`;"

echo "Creating database '${DB_NAME}'..."
mysql -u"$DB_USER" -p"$DB_PASS" -h "$DB_HOST" -P "$DB_PORT" -e "CREATE DATABASE \`${DB_NAME}\` CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"


echo "✅ Done: Database '${DB_NAME}' has been reset."
